import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
//导入购物车组件
import Carts from '../views/carts/Carts.vue'
import Main1 from '../views/carts/Main1.vue'
import Main2 from '../views/carts/Main2.vue'
//导入后台组件
import Login from '../views/login/Login.vue'
import Admin from '../views/admin/Admin.vue'
// import Users from '../views/users/Users.vue'
import Welcome from '../views/welcome/Welcome.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Admin',
    component: Admin,
    
    children:[
      {path:'welcome', alias: '/',component:Welcome}
    ]
  },
  {
    path:'/login',
    component:Login
  },
  {
    path:'/carts',
    component:Carts,
    children:[
      {path:'main1',component:Main1},
      {path:'main2',component:Main2},
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
